#

from flask_mail import Message
from ..extensions import mail


class Msg(object):
    def __init__(self, subject, recipients, message=None, **options):
        '''
        :param subject: type str
        :param recipients: type list
        :param message: type str
        :param options: type dict
        '''
        self.subject = subject
        self.recipients = recipients
        self.message = message
        self.options = options

    def sendmail(self):
        # send mail
        with mail.connect() as conn:
            for user in self.recipients:
                msg = Message(self.subject, recipients=[user])
                msg.body = self.message
                conn.send(msg)

    # qq
    # weixin
    # dingding
    def send(self):
        # all method
        pass
